import request from "@/lib/utils/request";
import { PaginationType, Response, ResponseWithPagination } from "../common";
import type { Post } from "./post.d";

export const getPostListApi = (
  params: PaginationType,
): ResponseWithPagination<Post> => {
  return request.get("/system/post/list", { params });
};

export const deletePostApi = (id: string): Response<null> => {
  return request.delete(`/system/post/${id}`);
};

export const getPostInfoApi = (id: string): Response<Post> => {
  return request.get(`/system/post/${id}`);
};

export const updatePostApi = (data: Post): Response<null> => {
  return request.put("/system/post", data);
};

export const addPostApi = (data: Post): Response<null> => {
  return request.post("/system/post", data);
};
